{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 读取文件"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读取文件｜指定行（顺序）\n",
    "<br>\n",
    "\n",
    "读取当前目录下 `某招聘网站数据.csv` 文件的 <font color = '#5F5FFC'>前20行</font>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T11:50:16.287112Z",
     "start_time": "2022-01-25T11:50:16.215112Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>positionId</th>\n",
       "      <th>positionName</th>\n",
       "      <th>companyId</th>\n",
       "      <th>companySize</th>\n",
       "      <th>industryField</th>\n",
       "      <th>financeStage</th>\n",
       "      <th>companyLabelList</th>\n",
       "      <th>firstType</th>\n",
       "      <th>secondType</th>\n",
       "      <th>thirdType</th>\n",
       "      <th>...</th>\n",
       "      <th>plus</th>\n",
       "      <th>pcShow</th>\n",
       "      <th>appShow</th>\n",
       "      <th>deliver</th>\n",
       "      <th>gradeDescription</th>\n",
       "      <th>promotionScoreExplain</th>\n",
       "      <th>isHotHire</th>\n",
       "      <th>count</th>\n",
       "      <th>aggregatePositionIds</th>\n",
       "      <th>famousCompany</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6802721</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>475770</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网,电商</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['绩效奖金', '带薪年假', '定期体检', '弹性工作']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5204912</td>\n",
       "      <td>数据建模</td>\n",
       "      <td>50735</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>电商</td>\n",
       "      <td>B轮</td>\n",
       "      <td>['年终奖金', '做五休二', '六险一金', '子女福利']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>建模</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>6877668</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>100125</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>移动互联网,企业服务</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['节日礼物', '年底双薪', '股票期权', '带薪年假']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6496141</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>26564</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>电商</td>\n",
       "      <td>D轮及以上</td>\n",
       "      <td>['生日趴', '每月腐败基金', '每月补贴', '年度旅游']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>6467417</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>29211</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>物流丨运输</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['技能培训', '免费班车', '专项奖金', '岗位晋升']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6882347</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>94826</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网,社交</td>\n",
       "      <td>B轮</td>\n",
       "      <td>['股票期权', '扁平管理', '五险一金', '岗位晋升']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>6841659</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>348784</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网,电商</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['大牛团队', '扁平管理', '年底双薪', '股票期权']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>6764018</td>\n",
       "      <td>数据建模工程师</td>\n",
       "      <td>13163</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['绩效奖金', '股票期权', '年底双薪', '专项奖金']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>建模</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>6458372</td>\n",
       "      <td>数据分析专家</td>\n",
       "      <td>34132</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>数据服务,广告营销</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>其他数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>6786904</td>\n",
       "      <td>数据分析师</td>\n",
       "      <td>13163</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['绩效奖金', '股票期权', '年底双薪', '专项奖金']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>BI工程师</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10 rows × 52 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   positionId positionName  companyId companySize industryField financeStage  \\\n",
       "0     6802721         数据分析     475770     50-150人      移动互联网,电商           A轮   \n",
       "1     5204912         数据建模      50735    150-500人            电商           B轮   \n",
       "2     6877668         数据分析     100125     2000人以上    移动互联网,企业服务         上市公司   \n",
       "3     6496141         数据分析      26564   500-2000人            电商        D轮及以上   \n",
       "4     6467417         数据分析      29211     2000人以上         物流丨运输         上市公司   \n",
       "5     6882347         数据分析      94826     50-150人      移动互联网,社交           B轮   \n",
       "6     6841659         数据分析     348784     50-150人      移动互联网,电商           A轮   \n",
       "7     6764018      数据建模工程师      13163   500-2000人         移动互联网         上市公司   \n",
       "8     6458372       数据分析专家      34132    150-500人     数据服务,广告营销           A轮   \n",
       "9     6786904        数据分析师      13163   500-2000人         移动互联网         上市公司   \n",
       "\n",
       "                      companyLabelList  firstType secondType thirdType  ...  \\\n",
       "0     ['绩效奖金', '带薪年假', '定期体检', '弹性工作']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "1     ['年终奖金', '做五休二', '六险一金', '子女福利']  开发|测试|运维类       数据开发        建模  ...   \n",
       "2     ['节日礼物', '年底双薪', '股票期权', '带薪年假']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "3    ['生日趴', '每月腐败基金', '每月补贴', '年度旅游']  开发|测试|运维类       数据开发      数据分析  ...   \n",
       "4     ['技能培训', '免费班车', '专项奖金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "5     ['股票期权', '扁平管理', '五险一金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "6     ['大牛团队', '扁平管理', '年底双薪', '股票期权']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "7     ['绩效奖金', '股票期权', '年底双薪', '专项奖金']  开发|测试|运维类       数据开发        建模  ...   \n",
       "8  ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']  产品|需求|项目类       数据分析    其他数据分析  ...   \n",
       "9     ['绩效奖金', '股票期权', '年底双薪', '专项奖金']  开发|测试|运维类       数据开发     BI工程师  ...   \n",
       "\n",
       "  plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
       "0  NaN      0       0       0              NaN                   NaN   \n",
       "1  NaN      0       0       0              NaN                   NaN   \n",
       "2  NaN      0       0       0              NaN                   NaN   \n",
       "3  NaN      0       0       0              NaN                   NaN   \n",
       "4  NaN      0       0       0              NaN                   NaN   \n",
       "5  NaN      0       0       0              NaN                   NaN   \n",
       "6  NaN      0       0       0              NaN                   NaN   \n",
       "7  NaN      0       0       0              NaN                   NaN   \n",
       "8  NaN      0       0       0              NaN                   NaN   \n",
       "9  NaN      0       0       0              NaN                   NaN   \n",
       "\n",
       "  isHotHire  count aggregatePositionIds famousCompany  \n",
       "0         0      0                   []         False  \n",
       "1         0      0                   []         False  \n",
       "2         0      0                   []         False  \n",
       "3         0      0                   []          True  \n",
       "4         0      0                   []          True  \n",
       "5         0      0                   []         False  \n",
       "6         0      0                   []         False  \n",
       "7         0      0                   []          True  \n",
       "8         0      0                   []         False  \n",
       "9         0      0                   []          True  \n",
       "\n",
       "[10 rows x 52 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>positionId</th>\n",
       "      <th>positionName</th>\n",
       "      <th>companyId</th>\n",
       "      <th>companySize</th>\n",
       "      <th>industryField</th>\n",
       "      <th>financeStage</th>\n",
       "      <th>companyLabelList</th>\n",
       "      <th>firstType</th>\n",
       "      <th>secondType</th>\n",
       "      <th>thirdType</th>\n",
       "      <th>...</th>\n",
       "      <th>plus</th>\n",
       "      <th>pcShow</th>\n",
       "      <th>appShow</th>\n",
       "      <th>deliver</th>\n",
       "      <th>gradeDescription</th>\n",
       "      <th>promotionScoreExplain</th>\n",
       "      <th>isHotHire</th>\n",
       "      <th>count</th>\n",
       "      <th>aggregatePositionIds</th>\n",
       "      <th>famousCompany</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>5269002</td>\n",
       "      <td>数据建模工程师</td>\n",
       "      <td>50576</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>移动互联网,游戏</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['带薪年假', '五险一金', '双休', '午餐补助']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>建模</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>6767669</td>\n",
       "      <td>数据分析专员</td>\n",
       "      <td>92417</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>移动互联网,广告营销</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['节日礼物', '股票期权', '带薪年假', '岗位晋升']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>6718750</td>\n",
       "      <td>旅游大数据分析师（杭州）</td>\n",
       "      <td>122019</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>数据服务,企业服务</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['年底双薪', '股票期权', '午餐补助', '定期体检']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>数据治理</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>6655562</td>\n",
       "      <td>数据分析建模工程师</td>\n",
       "      <td>117422215</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>数据服务,信息安全</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['午餐补助', '带薪年假', '16到18薪', '法定节假日']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>人工智能</td>\n",
       "      <td>机器学习</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>6677939</td>\n",
       "      <td>数据分析建模工程师（校招）</td>\n",
       "      <td>117422215</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>数据服务,信息安全</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['午餐补助', '带薪年假', '16到18薪', '法定节假日']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>人工智能</td>\n",
       "      <td>算法工程师</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>6884346</td>\n",
       "      <td>数据分析师</td>\n",
       "      <td>21236</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>移动互联网,医疗丨健康</td>\n",
       "      <td>C轮</td>\n",
       "      <td>['技能培训', '年底双薪', '节日礼物', '绩效奖金']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>101</th>\n",
       "      <td>6849100</td>\n",
       "      <td>商业数据分析</td>\n",
       "      <td>72076</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>移动互联网,电商</td>\n",
       "      <td>C轮</td>\n",
       "      <td>['节日礼物', '股票期权', '带薪年假', '年度旅游']</td>\n",
       "      <td>市场|商务类</td>\n",
       "      <td>市场|营销</td>\n",
       "      <td>商业数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>102</th>\n",
       "      <td>6803432</td>\n",
       "      <td>奔驰·耀出行-BI数据分析专家</td>\n",
       "      <td>751158</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>不需要融资</td>\n",
       "      <td>[]</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103</th>\n",
       "      <td>6704835</td>\n",
       "      <td>BI数据分析师</td>\n",
       "      <td>52840</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>电商</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['技能培训', '年底双薪', '节日礼物', '绩效奖金']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>104</th>\n",
       "      <td>6728058</td>\n",
       "      <td>数据分析专家-LQ(J181203029)</td>\n",
       "      <td>2474</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>汽车丨出行</td>\n",
       "      <td>不需要融资</td>\n",
       "      <td>['弹性工作', '节日礼物', '岗位晋升', '技能培训']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>其他数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10 rows × 52 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     positionId           positionName  companyId companySize industryField  \\\n",
       "95      5269002                数据建模工程师      50576    150-500人      移动互联网,游戏   \n",
       "96      6767669                 数据分析专员      92417     2000人以上    移动互联网,广告营销   \n",
       "97      6718750           旅游大数据分析师（杭州）     122019     50-150人     数据服务,企业服务   \n",
       "98      6655562              数据分析建模工程师  117422215     50-150人     数据服务,信息安全   \n",
       "99      6677939          数据分析建模工程师（校招）  117422215     50-150人     数据服务,信息安全   \n",
       "100     6884346                  数据分析师      21236   500-2000人   移动互联网,医疗丨健康   \n",
       "101     6849100                 商业数据分析      72076   500-2000人      移动互联网,电商   \n",
       "102     6803432        奔驰·耀出行-BI数据分析专家     751158    150-500人         移动互联网   \n",
       "103     6704835                BI数据分析师      52840     2000人以上            电商   \n",
       "104     6728058  数据分析专家-LQ(J181203029)       2474     2000人以上         汽车丨出行   \n",
       "\n",
       "    financeStage                     companyLabelList  firstType secondType  \\\n",
       "95            A轮       ['带薪年假', '五险一金', '双休', '午餐补助']  开发|测试|运维类       数据开发   \n",
       "96          上市公司     ['节日礼物', '股票期权', '带薪年假', '岗位晋升']  产品|需求|项目类       数据分析   \n",
       "97            A轮     ['年底双薪', '股票期权', '午餐补助', '定期体检']  开发|测试|运维类       数据开发   \n",
       "98            A轮  ['午餐补助', '带薪年假', '16到18薪', '法定节假日']  开发|测试|运维类       人工智能   \n",
       "99            A轮  ['午餐补助', '带薪年假', '16到18薪', '法定节假日']  开发|测试|运维类       人工智能   \n",
       "100           C轮     ['技能培训', '年底双薪', '节日礼物', '绩效奖金']  产品|需求|项目类       数据分析   \n",
       "101           C轮     ['节日礼物', '股票期权', '带薪年假', '年度旅游']     市场|商务类      市场|营销   \n",
       "102        不需要融资                                   []  开发|测试|运维类       数据开发   \n",
       "103         上市公司     ['技能培训', '年底双薪', '节日礼物', '绩效奖金']  开发|测试|运维类       数据开发   \n",
       "104        不需要融资     ['弹性工作', '节日礼物', '岗位晋升', '技能培训']  产品|需求|项目类       数据分析   \n",
       "\n",
       "    thirdType  ... plus pcShow appShow deliver gradeDescription  \\\n",
       "95         建模  ...  NaN      0       0       0              NaN   \n",
       "96       数据分析  ...  NaN      0       0       0              NaN   \n",
       "97       数据治理  ...  NaN      0       0       0              NaN   \n",
       "98       机器学习  ...  NaN      0       0       0              NaN   \n",
       "99      算法工程师  ...  NaN      0       0       0              NaN   \n",
       "100      数据分析  ...  NaN      0       0       0              NaN   \n",
       "101    商业数据分析  ...  NaN      0       0       0              NaN   \n",
       "102      数据分析  ...  NaN      0       0       0              NaN   \n",
       "103      数据分析  ...  NaN      0       0       0              NaN   \n",
       "104    其他数据分析  ...  NaN      0       0       0              NaN   \n",
       "\n",
       "    promotionScoreExplain isHotHire  count aggregatePositionIds famousCompany  \n",
       "95                    NaN         0      0                   []         False  \n",
       "96                    NaN         0      0                   []         False  \n",
       "97                    NaN         0      0                   []         False  \n",
       "98                    NaN         0      0                   []         False  \n",
       "99                    NaN         0      0                   []         False  \n",
       "100                   NaN         0      0                   []         False  \n",
       "101                   NaN         0      0                   []         False  \n",
       "102                   NaN         0      0                   []         False  \n",
       "103                   NaN         0      0                   []          True  \n",
       "104                   NaN         0      0                   []          True  \n",
       "\n",
       "[10 rows x 52 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df = pd.read_csv('某招聘网站数据.csv',header=0)\n",
    "df.head(10)\n",
    "df.tail(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读取文件｜指定行（跳过）\n",
    "\n",
    "读取当前目录下 某招聘网站数据.csv 文件并跳过前20行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T11:55:13.094912Z",
     "start_time": "2022-01-25T11:55:13.058912Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>positionId</th>\n",
       "      <th>positionName</th>\n",
       "      <th>companyId</th>\n",
       "      <th>companySize</th>\n",
       "      <th>industryField</th>\n",
       "      <th>financeStage</th>\n",
       "      <th>companyLabelList</th>\n",
       "      <th>firstType</th>\n",
       "      <th>secondType</th>\n",
       "      <th>thirdType</th>\n",
       "      <th>...</th>\n",
       "      <th>plus</th>\n",
       "      <th>pcShow</th>\n",
       "      <th>appShow</th>\n",
       "      <th>deliver</th>\n",
       "      <th>gradeDescription</th>\n",
       "      <th>promotionScoreExplain</th>\n",
       "      <th>isHotHire</th>\n",
       "      <th>count</th>\n",
       "      <th>aggregatePositionIds</th>\n",
       "      <th>famousCompany</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6829277</td>\n",
       "      <td>资深数据分析师</td>\n",
       "      <td>593</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>移动互联网,游戏</td>\n",
       "      <td>不需要融资</td>\n",
       "      <td>['五险一金', '交通补助', '绩效奖金', '节日礼物']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>高端产品职位</td>\n",
       "      <td>数据分析专家</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6267370</td>\n",
       "      <td>数据分析专家</td>\n",
       "      <td>31544</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>数据服务</td>\n",
       "      <td>不需要融资</td>\n",
       "      <td>['专业红娘牵线', '节日礼物', '技能培训', '岗位晋升']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>5927901</td>\n",
       "      <td>数据分析经理</td>\n",
       "      <td>62</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>文娱丨内容</td>\n",
       "      <td>C轮</td>\n",
       "      <td>['扁平管理', '弹性工作', '大厨定制三餐', '就近租房补贴']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>产品经理</td>\n",
       "      <td>其他产品经理</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6862245</td>\n",
       "      <td>数据分析专家</td>\n",
       "      <td>473950</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>未融资</td>\n",
       "      <td>[]</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5604926</td>\n",
       "      <td>数据分析师</td>\n",
       "      <td>143884</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网,金融</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['股票期权', '带薪年假', '绩效奖金', '年底双薪']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6601086</td>\n",
       "      <td>数据分析师</td>\n",
       "      <td>21187</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>企业服务,移动互联网</td>\n",
       "      <td>天使轮</td>\n",
       "      <td>['带薪年假', '年轻团队', '股票期权', '下午茶']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>6850849</td>\n",
       "      <td>数据分析专家</td>\n",
       "      <td>255742</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>金融,电商</td>\n",
       "      <td>C轮</td>\n",
       "      <td>['持牌金融机构', '跨境支付', '跨境金融', '国际化团队']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>5520623</td>\n",
       "      <td>数据分析经理</td>\n",
       "      <td>19875</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>硬件</td>\n",
       "      <td>不需要融资</td>\n",
       "      <td>['年终分红', '带薪年假', '年度旅游', '岗位晋升']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>6657704</td>\n",
       "      <td>数据分析师</td>\n",
       "      <td>165220</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>社交</td>\n",
       "      <td>不需要融资</td>\n",
       "      <td>['绩效奖金', '带薪年假', '交通补助', '午餐补助']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>6234992</td>\n",
       "      <td>数据分析师</td>\n",
       "      <td>542</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>消费生活</td>\n",
       "      <td>D轮及以上</td>\n",
       "      <td>['六险一金', '快乐高效文化', '绩效奖金', '信任']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10 rows × 52 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   positionId positionName  companyId companySize industryField financeStage  \\\n",
       "0     6829277      资深数据分析师        593     2000人以上      移动互联网,游戏        不需要融资   \n",
       "1     6267370       数据分析专家      31544    150-500人          数据服务        不需要融资   \n",
       "2     5927901       数据分析经理         62     2000人以上         文娱丨内容           C轮   \n",
       "3     6862245       数据分析专家     473950     50-150人         移动互联网          未融资   \n",
       "4     5604926        数据分析师     143884     50-150人      移动互联网,金融           A轮   \n",
       "5     6601086        数据分析师      21187    150-500人    企业服务,移动互联网          天使轮   \n",
       "6     6850849       数据分析专家     255742    150-500人         金融,电商           C轮   \n",
       "7     5520623       数据分析经理      19875     2000人以上            硬件        不需要融资   \n",
       "8     6657704        数据分析师     165220    150-500人            社交        不需要融资   \n",
       "9     6234992        数据分析师        542   500-2000人          消费生活        D轮及以上   \n",
       "\n",
       "                       companyLabelList  firstType secondType thirdType  ...  \\\n",
       "0      ['五险一金', '交通补助', '绩效奖金', '节日礼物']  产品|需求|项目类     高端产品职位    数据分析专家  ...   \n",
       "1    ['专业红娘牵线', '节日礼物', '技能培训', '岗位晋升']  开发|测试|运维类       数据开发      数据分析  ...   \n",
       "2  ['扁平管理', '弹性工作', '大厨定制三餐', '就近租房补贴']  产品|需求|项目类       产品经理    其他产品经理  ...   \n",
       "3                                    []  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "4      ['股票期权', '带薪年假', '绩效奖金', '年底双薪']  开发|测试|运维类       数据开发      数据分析  ...   \n",
       "5       ['带薪年假', '年轻团队', '股票期权', '下午茶']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "6   ['持牌金融机构', '跨境支付', '跨境金融', '国际化团队']  开发|测试|运维类       数据开发      数据分析  ...   \n",
       "7      ['年终分红', '带薪年假', '年度旅游', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "8      ['绩效奖金', '带薪年假', '交通补助', '午餐补助']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "9      ['六险一金', '快乐高效文化', '绩效奖金', '信任']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "\n",
       "  plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
       "0  NaN      0       0       0              NaN                   NaN   \n",
       "1  NaN      0       0       0              NaN                   NaN   \n",
       "2  NaN      0       0       0              NaN                   NaN   \n",
       "3  NaN      0       0       0              NaN                   NaN   \n",
       "4  NaN      0       0       0              NaN                   NaN   \n",
       "5  NaN      0       0       0              NaN                   NaN   \n",
       "6  NaN      0       0       0              NaN                   NaN   \n",
       "7  NaN      0       0       0              NaN                   NaN   \n",
       "8  NaN      0       0       0              NaN                   NaN   \n",
       "9  NaN      0       0       0              NaN                   NaN   \n",
       "\n",
       "  isHotHire  count aggregatePositionIds famousCompany  \n",
       "0         0      0                   []          True  \n",
       "1         0      0                   []         False  \n",
       "2         0      0                   []          True  \n",
       "3         0      0                   []         False  \n",
       "4         0      0                   []         False  \n",
       "5         0      0                   []         False  \n",
       "6         0      0                   []         False  \n",
       "7         0      0                   []          True  \n",
       "8         0      0                   []         False  \n",
       "9         0      0                   []          True  \n",
       "\n",
       "[10 rows x 52 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('某招聘网站数据.csv',header=0,skiprows=range(1,21))\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读取文件｜指定列（列号）\n",
    "\n",
    "根据指定列号读取\n",
    "\n",
    "读取当前目录下 某招聘网站数据.csv 文件的第 1、3、5 列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T11:56:30.112312Z",
     "start_time": "2022-01-25T11:56:30.097312Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>positionName</th>\n",
       "      <th>companySize</th>\n",
       "      <th>financeStage</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>数据分析</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>A轮</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>数据建模</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>B轮</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>数据分析</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>上市公司</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>数据分析</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>D轮及以上</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>数据分析</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>上市公司</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>数据分析</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>B轮</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>数据分析</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>A轮</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>数据建模工程师</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>上市公司</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>数据分析专家</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>A轮</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>数据分析师</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>上市公司</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  positionName companySize financeStage\n",
       "0         数据分析     50-150人           A轮\n",
       "1         数据建模    150-500人           B轮\n",
       "2         数据分析     2000人以上         上市公司\n",
       "3         数据分析   500-2000人        D轮及以上\n",
       "4         数据分析     2000人以上         上市公司\n",
       "5         数据分析     50-150人           B轮\n",
       "6         数据分析     50-150人           A轮\n",
       "7      数据建模工程师   500-2000人         上市公司\n",
       "8       数据分析专家    150-500人           A轮\n",
       "9        数据分析师   500-2000人         上市公司"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('某招聘网站数据.csv',usecols = [1,3,5])\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读取文件｜指定列（列名）\n",
    "\n",
    "根据指定列名读取\n",
    "\n",
    "读取当前目录下 某招聘网站数据.csv 文件的 positionId、positionName、salary 列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T11:57:09.608512Z",
     "start_time": "2022-01-25T11:57:09.591512Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>positionId</th>\n",
       "      <th>positionName</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6802721</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>37500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5204912</td>\n",
       "      <td>数据建模</td>\n",
       "      <td>15000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>6877668</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>3500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6496141</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>45000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>6467417</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>30000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6882347</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>50000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>6841659</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>30000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>6764018</td>\n",
       "      <td>数据建模工程师</td>\n",
       "      <td>35000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>6458372</td>\n",
       "      <td>数据分析专家</td>\n",
       "      <td>60000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>6786904</td>\n",
       "      <td>数据分析师</td>\n",
       "      <td>40000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   positionId positionName  salary\n",
       "0     6802721         数据分析   37500\n",
       "1     5204912         数据建模   15000\n",
       "2     6877668         数据分析    3500\n",
       "3     6496141         数据分析   45000\n",
       "4     6467417         数据分析   30000\n",
       "5     6882347         数据分析   50000\n",
       "6     6841659         数据分析   30000\n",
       "7     6764018      数据建模工程师   35000\n",
       "8     6458372       数据分析专家   60000\n",
       "9     6786904        数据分析师   40000"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('某招聘网站数据.csv',usecols = ['positionId','positionName','salary'])\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 根据指定列名匹配读取\n",
    "\n",
    "usecols = ['positionId','test','positionName', 'test1','salary']\n",
    "\n",
    "如果 usecols 中的列名存在于 某招聘网站数据.csv 中，则读取。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T11:58:58.194112Z",
     "start_time": "2022-01-25T11:58:58.177112Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>positionId</th>\n",
       "      <th>positionName</th>\n",
       "      <th>salary</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6802721</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>37500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5204912</td>\n",
       "      <td>数据建模</td>\n",
       "      <td>15000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>6877668</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>3500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6496141</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>45000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>6467417</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>30000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6882347</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>50000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>6841659</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>30000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>6764018</td>\n",
       "      <td>数据建模工程师</td>\n",
       "      <td>35000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>6458372</td>\n",
       "      <td>数据分析专家</td>\n",
       "      <td>60000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>6786904</td>\n",
       "      <td>数据分析师</td>\n",
       "      <td>40000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   positionId positionName  salary\n",
       "0     6802721         数据分析   37500\n",
       "1     5204912         数据建模   15000\n",
       "2     6877668         数据分析    3500\n",
       "3     6496141         数据分析   45000\n",
       "4     6467417         数据分析   30000\n",
       "5     6882347         数据分析   50000\n",
       "6     6841659         数据分析   30000\n",
       "7     6764018      数据建模工程师   35000\n",
       "8     6458372       数据分析专家   60000\n",
       "9     6786904        数据分析师   40000"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "usecols = ['positionId','test','positionName', 'test1','salary']\n",
    "cols = [x for x in df.columns if x in usecols]\n",
    "df = pd.read_csv('某招聘网站数据.csv',usecols = cols)\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读取文件｜缺失值标记\n",
    "\n",
    "读取当前目录下 某招聘网站数据.csv 文件，并将[]标记为缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:02:24.696512Z",
     "start_time": "2022-01-25T12:02:24.661512Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>positionId</th>\n",
       "      <th>positionName</th>\n",
       "      <th>companyId</th>\n",
       "      <th>companySize</th>\n",
       "      <th>industryField</th>\n",
       "      <th>financeStage</th>\n",
       "      <th>companyLabelList</th>\n",
       "      <th>firstType</th>\n",
       "      <th>secondType</th>\n",
       "      <th>thirdType</th>\n",
       "      <th>...</th>\n",
       "      <th>plus</th>\n",
       "      <th>pcShow</th>\n",
       "      <th>appShow</th>\n",
       "      <th>deliver</th>\n",
       "      <th>gradeDescription</th>\n",
       "      <th>promotionScoreExplain</th>\n",
       "      <th>isHotHire</th>\n",
       "      <th>count</th>\n",
       "      <th>aggregatePositionIds</th>\n",
       "      <th>famousCompany</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6802721</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>475770</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网,电商</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['绩效奖金', '带薪年假', '定期体检', '弹性工作']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5204912</td>\n",
       "      <td>数据建模</td>\n",
       "      <td>50735</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>电商</td>\n",
       "      <td>B轮</td>\n",
       "      <td>['年终奖金', '做五休二', '六险一金', '子女福利']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>建模</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>6877668</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>100125</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>移动互联网,企业服务</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['节日礼物', '年底双薪', '股票期权', '带薪年假']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6496141</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>26564</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>电商</td>\n",
       "      <td>D轮及以上</td>\n",
       "      <td>['生日趴', '每月腐败基金', '每月补贴', '年度旅游']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>6467417</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>29211</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>物流丨运输</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['技能培训', '免费班车', '专项奖金', '岗位晋升']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6882347</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>94826</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网,社交</td>\n",
       "      <td>B轮</td>\n",
       "      <td>['股票期权', '扁平管理', '五险一金', '岗位晋升']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>6841659</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>348784</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网,电商</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['大牛团队', '扁平管理', '年底双薪', '股票期权']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>6764018</td>\n",
       "      <td>数据建模工程师</td>\n",
       "      <td>13163</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['绩效奖金', '股票期权', '年底双薪', '专项奖金']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>建模</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>6458372</td>\n",
       "      <td>数据分析专家</td>\n",
       "      <td>34132</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>数据服务,广告营销</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>其他数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>6786904</td>\n",
       "      <td>数据分析师</td>\n",
       "      <td>13163</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['绩效奖金', '股票期权', '年底双薪', '专项奖金']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>BI工程师</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10 rows × 52 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   positionId positionName  companyId companySize industryField financeStage  \\\n",
       "0     6802721         数据分析     475770     50-150人      移动互联网,电商           A轮   \n",
       "1     5204912         数据建模      50735    150-500人            电商           B轮   \n",
       "2     6877668         数据分析     100125     2000人以上    移动互联网,企业服务         上市公司   \n",
       "3     6496141         数据分析      26564   500-2000人            电商        D轮及以上   \n",
       "4     6467417         数据分析      29211     2000人以上         物流丨运输         上市公司   \n",
       "5     6882347         数据分析      94826     50-150人      移动互联网,社交           B轮   \n",
       "6     6841659         数据分析     348784     50-150人      移动互联网,电商           A轮   \n",
       "7     6764018      数据建模工程师      13163   500-2000人         移动互联网         上市公司   \n",
       "8     6458372       数据分析专家      34132    150-500人     数据服务,广告营销           A轮   \n",
       "9     6786904        数据分析师      13163   500-2000人         移动互联网         上市公司   \n",
       "\n",
       "                      companyLabelList  firstType secondType thirdType  ...  \\\n",
       "0     ['绩效奖金', '带薪年假', '定期体检', '弹性工作']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "1     ['年终奖金', '做五休二', '六险一金', '子女福利']  开发|测试|运维类       数据开发        建模  ...   \n",
       "2     ['节日礼物', '年底双薪', '股票期权', '带薪年假']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "3    ['生日趴', '每月腐败基金', '每月补贴', '年度旅游']  开发|测试|运维类       数据开发      数据分析  ...   \n",
       "4     ['技能培训', '免费班车', '专项奖金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "5     ['股票期权', '扁平管理', '五险一金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "6     ['大牛团队', '扁平管理', '年底双薪', '股票期权']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "7     ['绩效奖金', '股票期权', '年底双薪', '专项奖金']  开发|测试|运维类       数据开发        建模  ...   \n",
       "8  ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']  产品|需求|项目类       数据分析    其他数据分析  ...   \n",
       "9     ['绩效奖金', '股票期权', '年底双薪', '专项奖金']  开发|测试|运维类       数据开发     BI工程师  ...   \n",
       "\n",
       "  plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
       "0  NaN      0       0       0              NaN                   NaN   \n",
       "1  NaN      0       0       0              NaN                   NaN   \n",
       "2  NaN      0       0       0              NaN                   NaN   \n",
       "3  NaN      0       0       0              NaN                   NaN   \n",
       "4  NaN      0       0       0              NaN                   NaN   \n",
       "5  NaN      0       0       0              NaN                   NaN   \n",
       "6  NaN      0       0       0              NaN                   NaN   \n",
       "7  NaN      0       0       0              NaN                   NaN   \n",
       "8  NaN      0       0       0              NaN                   NaN   \n",
       "9  NaN      0       0       0              NaN                   NaN   \n",
       "\n",
       "  isHotHire  count aggregatePositionIds famousCompany  \n",
       "0         0      0                  NaN         False  \n",
       "1         0      0                  NaN         False  \n",
       "2         0      0                  NaN         False  \n",
       "3         0      0                  NaN          True  \n",
       "4         0      0                  NaN          True  \n",
       "5         0      0                  NaN         False  \n",
       "6         0      0                  NaN         False  \n",
       "7         0      0                  NaN          True  \n",
       "8         0      0                  NaN         False  \n",
       "9         0      0                  NaN          True  \n",
       "\n",
       "[10 rows x 52 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "df = pd.read_csv('某招聘网站数据.csv',na_values = '[]')\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读取文件｜指定格式\n",
    "\n",
    "读取当前目录下 某招聘网站数据.csv 文件，并将 positionId,companyId 设置为字符串格式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:05:34.458913Z",
     "start_time": "2022-01-25T12:05:34.419913Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>positionId</th>\n",
       "      <th>positionName</th>\n",
       "      <th>companyId</th>\n",
       "      <th>companySize</th>\n",
       "      <th>industryField</th>\n",
       "      <th>financeStage</th>\n",
       "      <th>companyLabelList</th>\n",
       "      <th>firstType</th>\n",
       "      <th>secondType</th>\n",
       "      <th>thirdType</th>\n",
       "      <th>...</th>\n",
       "      <th>plus</th>\n",
       "      <th>pcShow</th>\n",
       "      <th>appShow</th>\n",
       "      <th>deliver</th>\n",
       "      <th>gradeDescription</th>\n",
       "      <th>promotionScoreExplain</th>\n",
       "      <th>isHotHire</th>\n",
       "      <th>count</th>\n",
       "      <th>aggregatePositionIds</th>\n",
       "      <th>famousCompany</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6802721</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>475770</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网,电商</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['绩效奖金', '带薪年假', '定期体检', '弹性工作']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5204912</td>\n",
       "      <td>数据建模</td>\n",
       "      <td>50735</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>电商</td>\n",
       "      <td>B轮</td>\n",
       "      <td>['年终奖金', '做五休二', '六险一金', '子女福利']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>建模</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>6877668</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>100125</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>移动互联网,企业服务</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['节日礼物', '年底双薪', '股票期权', '带薪年假']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>6496141</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>26564</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>电商</td>\n",
       "      <td>D轮及以上</td>\n",
       "      <td>['生日趴', '每月腐败基金', '每月补贴', '年度旅游']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>6467417</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>29211</td>\n",
       "      <td>2000人以上</td>\n",
       "      <td>物流丨运输</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['技能培训', '免费班车', '专项奖金', '岗位晋升']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6882347</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>94826</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网,社交</td>\n",
       "      <td>B轮</td>\n",
       "      <td>['股票期权', '扁平管理', '五险一金', '岗位晋升']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>6841659</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>348784</td>\n",
       "      <td>50-150人</td>\n",
       "      <td>移动互联网,电商</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['大牛团队', '扁平管理', '年底双薪', '股票期权']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>6764018</td>\n",
       "      <td>数据建模工程师</td>\n",
       "      <td>13163</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['绩效奖金', '股票期权', '年底双薪', '专项奖金']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>建模</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>6458372</td>\n",
       "      <td>数据分析专家</td>\n",
       "      <td>34132</td>\n",
       "      <td>150-500人</td>\n",
       "      <td>数据服务,广告营销</td>\n",
       "      <td>A轮</td>\n",
       "      <td>['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']</td>\n",
       "      <td>产品|需求|项目类</td>\n",
       "      <td>数据分析</td>\n",
       "      <td>其他数据分析</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>6786904</td>\n",
       "      <td>数据分析师</td>\n",
       "      <td>13163</td>\n",
       "      <td>500-2000人</td>\n",
       "      <td>移动互联网</td>\n",
       "      <td>上市公司</td>\n",
       "      <td>['绩效奖金', '股票期权', '年底双薪', '专项奖金']</td>\n",
       "      <td>开发|测试|运维类</td>\n",
       "      <td>数据开发</td>\n",
       "      <td>BI工程师</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>[]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10 rows × 52 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "  positionId positionName companyId companySize industryField financeStage  \\\n",
       "0    6802721         数据分析    475770     50-150人      移动互联网,电商           A轮   \n",
       "1    5204912         数据建模     50735    150-500人            电商           B轮   \n",
       "2    6877668         数据分析    100125     2000人以上    移动互联网,企业服务         上市公司   \n",
       "3    6496141         数据分析     26564   500-2000人            电商        D轮及以上   \n",
       "4    6467417         数据分析     29211     2000人以上         物流丨运输         上市公司   \n",
       "5    6882347         数据分析     94826     50-150人      移动互联网,社交           B轮   \n",
       "6    6841659         数据分析    348784     50-150人      移动互联网,电商           A轮   \n",
       "7    6764018      数据建模工程师     13163   500-2000人         移动互联网         上市公司   \n",
       "8    6458372       数据分析专家     34132    150-500人     数据服务,广告营销           A轮   \n",
       "9    6786904        数据分析师     13163   500-2000人         移动互联网         上市公司   \n",
       "\n",
       "                      companyLabelList  firstType secondType thirdType  ...  \\\n",
       "0     ['绩效奖金', '带薪年假', '定期体检', '弹性工作']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "1     ['年终奖金', '做五休二', '六险一金', '子女福利']  开发|测试|运维类       数据开发        建模  ...   \n",
       "2     ['节日礼物', '年底双薪', '股票期权', '带薪年假']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "3    ['生日趴', '每月腐败基金', '每月补贴', '年度旅游']  开发|测试|运维类       数据开发      数据分析  ...   \n",
       "4     ['技能培训', '免费班车', '专项奖金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "5     ['股票期权', '扁平管理', '五险一金', '岗位晋升']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "6     ['大牛团队', '扁平管理', '年底双薪', '股票期权']  产品|需求|项目类       数据分析      数据分析  ...   \n",
       "7     ['绩效奖金', '股票期权', '年底双薪', '专项奖金']  开发|测试|运维类       数据开发        建模  ...   \n",
       "8  ['开放式办公', '扁平管理', '带薪假期', '弹性工作时间']  产品|需求|项目类       数据分析    其他数据分析  ...   \n",
       "9     ['绩效奖金', '股票期权', '年底双薪', '专项奖金']  开发|测试|运维类       数据开发     BI工程师  ...   \n",
       "\n",
       "  plus pcShow appShow deliver gradeDescription promotionScoreExplain  \\\n",
       "0  NaN      0       0       0              NaN                   NaN   \n",
       "1  NaN      0       0       0              NaN                   NaN   \n",
       "2  NaN      0       0       0              NaN                   NaN   \n",
       "3  NaN      0       0       0              NaN                   NaN   \n",
       "4  NaN      0       0       0              NaN                   NaN   \n",
       "5  NaN      0       0       0              NaN                   NaN   \n",
       "6  NaN      0       0       0              NaN                   NaN   \n",
       "7  NaN      0       0       0              NaN                   NaN   \n",
       "8  NaN      0       0       0              NaN                   NaN   \n",
       "9  NaN      0       0       0              NaN                   NaN   \n",
       "\n",
       "  isHotHire  count aggregatePositionIds famousCompany  \n",
       "0         0      0                   []         False  \n",
       "1         0      0                   []         False  \n",
       "2         0      0                   []         False  \n",
       "3         0      0                   []          True  \n",
       "4         0      0                   []          True  \n",
       "5         0      0                   []         False  \n",
       "6         0      0                   []         False  \n",
       "7         0      0                   []          True  \n",
       "8         0      0                   []         False  \n",
       "9         0      0                   []          True  \n",
       "\n",
       "[10 rows x 52 columns]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "0    6802721\n",
       "1    5204912\n",
       "2    6877668\n",
       "3    6496141\n",
       "4    6467417\n",
       "5    6882347\n",
       "6    6841659\n",
       "7    6764018\n",
       "8    6458372\n",
       "9    6786904\n",
       "Name: positionId, dtype: object"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('某招聘网站数据.csv',dtype = {'positionId':str,'companyId':str})\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读取文件｜指定格式（时间）\n",
    "\n",
    "读取当前目录下 某招聘网站数据.csv 文件，并将 createTime 列设置为字符串格式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:07:53.047913Z",
     "start_time": "2022-01-25T12:07:53.031913Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    2020/3/16 11:00\n",
       "1    2020/3/16 11:08\n",
       "2    2020/3/16 10:33\n",
       "3    2020/3/16 10:10\n",
       "4     2020/3/16 9:56\n",
       "5     2020/3/16 9:54\n",
       "6     2020/3/16 9:41\n",
       "7    2020/3/16 11:18\n",
       "8    2020/3/16 10:57\n",
       "9    2020/3/16 11:18\n",
       "Name: createTime, dtype: object"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('某招聘网站数据.csv',dtype = {'createTime':str})\n",
    "df.createTime.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 从剪贴板读取数据\n",
    "打开当前目录下 Titanic.txt 文件，全选并复制。\n",
    "现在直接从剪贴板读取数据。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:08:36.924513Z",
     "start_time": "2022-01-25T12:08:36.912513Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>df</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [df]\n",
       "Index: []"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_clipboard()\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 从sql数据库读取数据\n",
    "在 pandas 中支持直接从 sql 中查询并读取。\n",
    "\n",
    "请先执行下面的代码创建数据。\n",
    "\n",
    "然后将 SQL 语句 SELECT int_column, date_column FROM test_data 转换为 DataFrame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-12T23:07:56.410002Z",
     "start_time": "2022-01-12T23:07:55.661002Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from sqlite3 import connect\n",
    "conn = connect(':memory:')\n",
    "df = pd.DataFrame(data=[[0, '10/11/12'], [1, '12/11/10']],\n",
    "                  columns=['int_column', 'date_column'])\n",
    "df.to_sql('test_data', conn)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 23 从网页读取数据\n",
    "\n",
    "<br>\n",
    "\n",
    "直接从福布斯2022全球富豪榜数据。\n",
    "\n",
    "目标网站地址为 `https://www.phb123.com/renwu/fuhao/shishi_1.html`\n",
    "\n",
    "思考：什么类型的在线表格可以直接读取？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:14:47.102313Z",
     "start_time": "2022-01-25T12:14:46.670313Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>世界排名</th>\n",
       "      <th>名字</th>\n",
       "      <th>财富(10亿美元)</th>\n",
       "      <th>财富来源</th>\n",
       "      <th>国家/地区</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>杰夫·贝佐斯</td>\n",
       "      <td>1914亿美元</td>\n",
       "      <td>亚马逊</td>\n",
       "      <td>美国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>埃隆·马斯克</td>\n",
       "      <td>1657亿美元</td>\n",
       "      <td>特斯拉</td>\n",
       "      <td>美国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>伯纳德·阿诺特</td>\n",
       "      <td>1647亿美元</td>\n",
       "      <td>LVMH</td>\n",
       "      <td>法国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>比尔·盖茨</td>\n",
       "      <td>1293亿美元</td>\n",
       "      <td>微软</td>\n",
       "      <td>美国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>马克·扎克伯格</td>\n",
       "      <td>1140亿美元</td>\n",
       "      <td>Facebook</td>\n",
       "      <td>美国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>沃伦•巴菲特</td>\n",
       "      <td>996亿美元</td>\n",
       "      <td>伯克希尔－哈撒韦公司</td>\n",
       "      <td>美国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>拉里·埃里森</td>\n",
       "      <td>983亿美元</td>\n",
       "      <td>甲骨文软件</td>\n",
       "      <td>美国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>拉里·佩奇</td>\n",
       "      <td>972亿美元</td>\n",
       "      <td>谷歌</td>\n",
       "      <td>美国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>9</td>\n",
       "      <td>谢尔盖·布林</td>\n",
       "      <td>943亿美元</td>\n",
       "      <td>谷歌</td>\n",
       "      <td>美国</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>10</td>\n",
       "      <td>弗朗索瓦丝·贝当古-梅耶斯</td>\n",
       "      <td>780亿美元</td>\n",
       "      <td>欧莱雅</td>\n",
       "      <td>法国</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   世界排名             名字 财富(10亿美元)        财富来源 国家/地区\n",
       "0     1         杰夫·贝佐斯   1914亿美元         亚马逊    美国\n",
       "1     2         埃隆·马斯克   1657亿美元         特斯拉    美国\n",
       "2     3        伯纳德·阿诺特   1647亿美元        LVMH    法国\n",
       "3     4          比尔·盖茨   1293亿美元          微软    美国\n",
       "4     5        马克·扎克伯格   1140亿美元    Facebook    美国\n",
       "5     6         沃伦•巴菲特    996亿美元  伯克希尔－哈撒韦公司    美国\n",
       "6     7         拉里·埃里森    983亿美元       甲骨文软件    美国\n",
       "7     8          拉里·佩奇    972亿美元          谷歌    美国\n",
       "8     9         谢尔盖·布林    943亿美元          谷歌    美国\n",
       "9    10  弗朗索瓦丝·贝当古-梅耶斯    780亿美元         欧莱雅    法国"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_html('https://www.phb123.com/renwu/fuhao/shishi_1.html')[0]\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:14:32.793713Z",
     "start_time": "2022-01-25T12:14:32.620713Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>名称</th>\n",
       "      <th>最新价</th>\n",
       "      <th>涨跌幅</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  名称 最新价 涨跌幅\n",
       "0  -   -   -\n",
       "1  -   -   -\n",
       "2  -   -   -\n",
       "3  -   -   -\n",
       "4  -   -   -\n",
       "5  -   -   -"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_html('http://quote.eastmoney.com/zs000001.html?from=BaiduAladdin')[3]\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 从字典创建DataFrame\n",
    "\n",
    "将下方字典转换为`dataframe`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:15:31.897313Z",
     "start_time": "2022-01-25T12:15:31.891313Z"
    }
   },
   "outputs": [],
   "source": [
    "d = {\n",
    "    \"one\": pd.Series([1.0, 2.0, 3.0], index=[\"a\", \"b\", \"c\"]),\n",
    "    \"two\": pd.Series([1.0, 2.0, 3.0, 4.0], index=[\"a\", \"b\", \"c\", \"d\"]) }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:15:33.551313Z",
     "start_time": "2022-01-25T12:15:33.538313Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>one</th>\n",
       "      <th>two</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>2.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>NaN</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   one  two\n",
       "a  1.0  1.0\n",
       "b  2.0  2.0\n",
       "c  3.0  3.0\n",
       "d  NaN  4.0"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(d)\n",
    "df.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 从字典创建｜字典列表\n",
    "<br>\n",
    "\n",
    "将下方列表型字典转换为`dataframe`\n",
    "\n",
    "思考：如何指定行/列索引？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:18:24.445313Z",
     "start_time": "2022-01-25T12:18:24.438313Z"
    }
   },
   "outputs": [],
   "source": [
    "d = [{\"a\": 1, \"b\": 2}, {\"a\": 5, \"b\": 10, \"c\": 20}]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:18:26.115313Z",
     "start_time": "2022-01-25T12:18:26.100313Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>a</th>\n",
       "      <th>b</th>\n",
       "      <th>c</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "      <td>20.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   a   b     c\n",
       "0  1   2   NaN\n",
       "1  5  10  20.0"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(d)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 从元组创建DataFrame\n",
    "\n",
    "<br>\n",
    "\n",
    "将下面的元组转换为 dataframe 且行列索引均为 `1,2,3,4`,columns 为 'A,B,C,D' "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:19:41.993713Z",
     "start_time": "2022-01-25T12:19:41.989713Z"
    }
   },
   "outputs": [],
   "source": [
    "t =((1,0,0,0,),(2,3,0,0,),(4,5,6,0,),(7,8,9,10,))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:21:19.655313Z",
     "start_time": "2022-01-25T12:21:19.641313Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7</td>\n",
       "      <td>8</td>\n",
       "      <td>9</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   A  B  C   D\n",
       "0  1  0  0   0\n",
       "1  2  3  0   0\n",
       "2  4  5  6   0\n",
       "3  7  8  9  10"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(t,columns = ['A','B','C','D'])\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 33 保存为 CSV｜指定列|取消索引\n",
    "\n",
    "<br>\n",
    "将data读取到的数据保存为 `csv` 格式至当前目录下（文件名任意），且只保留`positionName、salary`两列，不要索引列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:22:04.474713Z",
     "start_time": "2022-01-25T12:22:04.462713Z"
    }
   },
   "outputs": [],
   "source": [
    "data = pd.read_csv(\"某招聘网站数据.csv\",nrows = 20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 保存为 CSV｜标记缺失值\n",
    "\n",
    "<br>\n",
    "\n",
    "在上一题的基础上，在保存的同时，将缺失值标记为`'数据缺失'`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "dir()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2022-01-25T12:25:45.851313Z",
     "start_time": "2022-01-25T12:25:45.837313Z"
    }
   },
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "to_csv() got an unexpected keyword argument 'newline'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-65-c7a5171f3ff7>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;32mwith\u001b[0m \u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'123.csv'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'w'\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m     \u001b[0mdata\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mto_csv\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mindex\u001b[0m \u001b[1;33m=\u001b[0m\u001b[1;32mFalse\u001b[0m \u001b[1;33m,\u001b[0m\u001b[0mna_rep\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;34m'数据缺失'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mnewline\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m''\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: to_csv() got an unexpected keyword argument 'newline'"
     ]
    }
   ],
   "source": [
    "with open('123.csv','w',newline='') as f:\n",
    "    data.to_csv(f,index =False ,na_rep = '数据缺失')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 保存为CSV｜压缩\n",
    "\n",
    "<br>\n",
    "\n",
    "将上一题的数据保存至 `zip` 文件，解压后出现 `out.csv`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 保存为 JSON\n",
    "\n",
    "将上一题的数据保存为 `.json` 格式至当前目录下（文件名任意）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 保存为 Html\n",
    "\n",
    "将之前的数据保存为 `html` 格式至当前目录下（文件名任意），并进行如下设置\n",
    "- 取消行索引\n",
    "- 标题居中对齐\n",
    "- 列宽100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": true
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
